
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no, email=no">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="HandheldFriendly" content="true">
<meta name="MobileOptimized" content="640">
<meta name="screen-orientation" content="portrait">
<meta name="x5-orientation" content="portrait">
<meta name="full-screen" content="yes">
<meta name="x5-fullscreen" content="true">
<meta name="browsermode" content="application">
<meta name="x5-page-mode" content="app">
<meta name="msapplication-tap-highlight" content="no">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta name="show-image" content="http://www.66play.com/Public/Home/images/con-logo.png">
<meta charset="utf-8">
<title>活动中心</title>
<link href="__PUBLIC__/App/css/style.css?ver=1.0" style="text/css" rel="stylesheet">
<link href="__PUBLIC__/App/css/common.css?ver=1.0" style="text/css" rel="stylesheet">
<script type="text/javascript" src="__PUBLIC__/App/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/App/js/jquery_public.js"></script>
<script type="text/javascript" src="__PUBLIC__/App/js/jquery.event.drag-1.5.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/App/js/jquery.touchSlider.js"></script>

</head>

<body class="details_bg">
    <div class="main_visual">
        <div class="main_image">
            <ul>
                <volist name="gift.pics" id="img">
                <li>
                    <span style="background:url('{$img}') no-repeat scroll center top / cover "></span>
                </li>
                </volist>
            </ul>
        </div>
    </div>
    <div class="pb20 wh ov">
        <div class="details_Box details_Box1">
            <if condition="$user.score lt $gift.score">
                <a class="JS-exchange" style="background:#888">积分不足</a>
            <elseif condition="$gift.stock lt 1" />
                <a class="JS-exchange" style="background:#888">库存不足</a>
            <else />
                <a class="JS-exchange" onclick="exchange()">立即兑换</a>
            </if>
            <span>{$gift.score}</span>
            <font><img src="__PUBLIC__/App/images/details_mony.png"></font>
        </div>
        <div class="details_content">
            <div class="details_tt">
                <span>商品简介：</span>
            </div>
            <div class="wh details_txt">{$gift.name}</div>
            <div class="wh details_ts">{$gift.content}</div>
            <div class="details_tt">
                <span>兑换流程：</span>
            </div>
            <div class="wh details_txt">{$gift.flow}</div>
            <div class="wh details_ft">
                <div class="tt"><span><font>重要说明</font></span></div>
                <div class="bd">
                    <div class="txt">{$gift.explain}</div>
                </div>
                <div class="txt1">活动由龙渊网络提供，与游戏公司无关</div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
    {:C('GLOBAL_BDHM')}
    $(document).ready(function(){

        $(".main_visual").hover(function(){
            $("#btn_prev,#btn_next").fadeIn()
        },function(){
            $("#btn_prev,#btn_next").fadeOut()
        });
        
        $dragBln = false;
        
        $(".main_image").touchSlider({
            flexible : true,
            speed : 200,
            btn_prev : $("#btn_prev"),
            btn_next : $("#btn_next"),
            paging : $(".flicking_con a"),
            counter : function (e){
                $(".flicking_con a").removeClass("on").eq(e.current-1).addClass("on");
            }
        });
        
        $(".main_image").bind("mousedown", function() {
            $dragBln = false;
        });
        
        $(".main_image").bind("dragstart", function() {
            $dragBln = true;
        });
        
        $(".main_image a").click(function(){
            if($dragBln) {
                return false;
            }
        });
        
        timer = setInterval(function(){
            $("#btn_next").click();
        }, 5000);
        
        $(".main_visual").hover(function(){
            clearInterval(timer);
        },function(){
            timer = setInterval(function(){
                $("#btn_next").click();
            },5000);
        });
        
        $(".main_image").bind("touchstart",function(){
            clearInterval(timer);
        }).bind("touchend", function(){
            timer = setInterval(function(){
                $("#btn_next").click();
            }, 5000);
        });
    });
    var gift_id = {$gift.id};
    var user_token = '{$appToken}';
    var exchange_uri = '{:U("api/gift/exchange")}';
    var isPending = false;
    function exchange(){
        if (isPending || !confirm('确认使用{$gift.score}积分兑换{$gift.name}？')) {
            return;
        }
        isPending = true;
        $('.JS-exchange').html('正在兑换');
        $('.JS-exchange').css({'background':'#888'});
        $.post(exchange_uri, {id: gift_id, appToken: user_token}, function(res){
            if (res.code != 200) {
                alert(res.info);
                $('.JS-exchange').html('立即兑换');
                $('.JS-exchange').css({'background':''});
                isPending = false;
            } else {
                alert('兑换成功, 请到积分记录查看获取的礼品码');
                location.href = '{:U("mall/log")}';
            }
        });
    }
    </script>
</body>
</html>